import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';

import '../services/global.dart';

class SelectFold extends StatefulWidget {
  const SelectFold({super.key});

  @override
  State<SelectFold> createState() => _SelectFoldState();
}

class _SelectFoldState extends State<SelectFold> {
  final service = Get.find<GlobalService>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('选择文件夹',style: TextStyle(
          color: Colors.white
        ),),
        centerTitle: true,
        backgroundColor: Colors.black,
      ),
      backgroundColor: Colors.black,
      body: ListView.builder(
          itemCount: service.foldList.length,
          itemBuilder: (context,index){
            final fd = service.foldList[index];
            return GestureDetector(
              onTap: (){
                Get.back(result: fd);
              },
              child: Container(
                margin: EdgeInsets.only(left: 16.0,right: 16,bottom: 16),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(16.0),
                    color: Color(0xff343434)
                ),
                child: ListTile(
                  title: Text(fd.name,style: TextStyle(
                      color: Colors.white,
                      fontWeight: FontWeight.bold,
                      fontSize: 18
                  ),),
                  trailing: Text('',style: TextStyle(
                      color: Colors.white,
                      fontWeight: FontWeight.bold,
                      fontSize: 18
                  ),),
                ),
              ),
            );
          }),
    );
  }
}
